<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.0.1
 *	LISENSE: FL87MPRYOA0R - http://www.flynax.com/license-agreement.html
 *	PRODUCT: Auto Classifieds
 *	DOMAIN: www.siyaradiali.com
 *	FILE: CONTROL.INC.PHP
 *
 *	This script is a commercial software and any kind of using it must be 
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out 
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2012
 *	http://www.flynax.com/
 *
 ******************************************************************************/

session_start();

require_once( RL_CLASSES . 'rlDb.class.php' );
require_once( RL_CLASSES . 'reefless.class.php' );

$rlDb = &new rlDb();
$reefless = &new reefless();

/* load classes */
$reefless -> connect(RL_DBHOST, RL_DBPORT, RL_DBUSER, RL_DBPASS, RL_DBNAME);
$reefless -> loadClass( 'Debug' );
$reefless -> loadClass( 'Config' );
$reefless -> loadClass( 'Lang' );
$reefless -> loadClass( 'Valid' );
$reefless -> loadClass( 'Hook' );
$reefless -> loadClass( 'Listings' );
$reefless -> loadClass( 'Categories' );

if ( !isset($_SERVER['SHELL']) )
{
	/* load ajax library */
	require_once( RL_AJAX . 'xajax_core' . RL_DS . 'xajax.inc.php' );
	
	$rlXajax = &new xajax();
	$_response = &new xajaxResponse();
	$GLOBALS['_response'] = $_response;
	
	$rlXajax -> configure('javascript URI', RL_URL_HOME . 'libs/ajax/' );
	$rlXajax -> configure('debug', RL_AJAX_DEBUG);
	
	$rlXajax -> setCharEncoding( 'UTF-8' );
	/* ajax library end */
}

/* load system configurations */
$config = $rlConfig -> allConfig();
$GLOBALS['config'] = $config;

/* load smarty library */
require_once( RL_LIBS . 'smarty' . RL_DS . 'Smarty.class.php' );
$reefless -> loadClass( 'Smarty' );

/* assign configs to template */
$rlSmarty -> assign_by_ref( 'config', $config );

define('RL_SETUP', 'JGxpY2Vuc2VfZG9tYWluID0gInd3dy5zaXlhcmFkaWFsaS5jb20iOwoJCQkJCSAkbGljZW5zZV9udW1iZXIgPSAiRkw4N01QUllPQTBSIjs=');

/* gpc checking */
if (get_magic_quotes_gpc())
{
	if ( isset($_SERVER['CONTENT_TYPE']) )
	{
		$in = array(&$_GET, &$_POST);
		while (list($k,$v) = each($in))
		{
			foreach ($v as $key => $val)
			{
				if (!is_array($val)) {
					$in[$k][$key] = str_replace(array("\'", '\"'), array( "'", '"'), $val);
					continue;
				}
				$in[] = &$in[$k][$key];
			}
		}
		unset($in);
	}
}